<template>
  <div>
    <el-card class="box-card" shadow="always" style="width: 100%">
      <div slot="header">
        <h2 class="h2">填写订单信息</h2>
      </div>
      <div class="form-container">
        <el-form ref="orderForm" :model="formData" label-width="80px">
          <el-form-item label="收货姓名">
            <el-input
              v-model="formData.name"
              placeholder="请输入收货姓名"
              :style="{ width: '200px' }"
            ></el-input>
          </el-form-item>
          <el-form-item label="手机号码">
            <el-input
              v-model="formData.phone"
              placeholder="请输入手机号码"
              :style="{ width: '200px' }"
            ></el-input>
          </el-form-item>
          <!-- 这里直接填写收货地址，还未整合地址管理组件 -->
          <el-form-item label="收货地址">
            <el-input
              type="textarea"
              autosize
              v-model="formData.address"
              placeholder="请输入详细收货地址"
              :style="{ width: '600px' }"
            ></el-input>
          </el-form-item>
          <!-- 其他表单项可根据需要添加 -->
          <el-form-item>
            <el-button type="primary" @click="submitOrder">提交订单</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "OrderForm",
  data() {
    return {
      formData: {
        name: "",
        phone: "",
        address: "", // 收货地址直接作为文本输入
      },
    };
  },
  methods: {
    submitOrder() {
      console.log("Submit order with data:", this.formData);
      this.$router.push("/home/Order");
    },
  },
};
</script>

<style scoped>
.form-container {
  padding: 20px;
}
.h2 {
  color: #91ab96;
}
</style>
